﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ObserverSample
{
    class ConcreteAllyControlCenter:AllyConrolCenter
    {
        public ConcreteAllyControlCenter(string allyName)
        {
            Console.WriteLine($"战队名称为{allyName}");
            Console.WriteLine("============================");
            this.allyName = allyName;
        }

        public override void NoteifyOBsever(string name)
        {
            Console.WriteLine($"{this.allyName}在遭到攻击，队友{name}遭到敌人攻击");
            foreach (object obs in players)
            {
                if (((IObserver)obs).Name!=name)
                {
                    ((IObserver)obs).Help();
                }
            }
        }
    }
}
